package com.ego.controller;

import com.ego.commons.pojo.EgoResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PageController {

        /*
        * 登录页面
        * */
        @RequestMapping("/")
        public String login(){
            return "login";
        }

        //显示主页面
    @RequestMapping("/main")
    public String showIndex(){
        return "index";
    }

    //登录成功后跳转的控制器
    @RequestMapping("/loginSuccess")
    @ResponseBody
    public EgoResult loginSuccess(){
            return EgoResult.ok();
    }


    /**
     * restful风格  根据值返回页面
     * @param page
     * @return   页面
     */
    @RequestMapping("/{page}")
    public String showPage(@PathVariable String page){
            return page;
    }

    // 返回编辑页
    @RequestMapping("/rest/page/item-edit")
    public String showEdit(){
        return "item-edit";
    }
}
